<template>
  <div id="home">
  	<home-header></home-header>
    <home-swiper :swiperSlides="swiperList"></home-swiper>
    <home-icon :iconList="iconList"></home-icon>
    <home-hot :recommendList="recommendList"></home-hot>
    <home-weekend :weekendList="weekendList"></home-weekend>
  </div>
</template>

<script>
import HomeHeader from './components/HomeHeader';
import HomeSwiper from './components/HomeSwiper';
import HomeIcon from './components/HomeIcon';
import HomeHot from './components/HomeHot';
import HomeWeekend from './components/weekend';
import axios from 'axios';

export default {
  name: 'Home',
  data() {
  	return {
  		swiperList: [],
      iconList: [],
      weekendList: [],
      recommendList: []
  	};
  },
  components: {
    HomeHeader,
    HomeSwiper,
    HomeIcon,
    HomeHot,
    HomeWeekend
  },
  mounted() {
    axios.get('api/index.json')
      .then(this.getHomeInfoSucc)
  },
  methods: {
    getHomeInfoSucc(res) {
      const resdata = res.data
      if (resdata.ret && resdata.data) {
        const data = resdata.data
        this.swiperList = data.swiperList
        this.iconList = data.iconList
        this.recommendList = data.recommendList
        this.weekendList = data.weekendList
      }
    }
  }
};
</script>

<style>
</style>
